<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8"/>
	<meta name="keywords" content="script, AppleScript, terminology"/>
	<link rel="stylesheet" href="../../Shared/sty/standard.css"/>
	<script defer src="../../Shared/js/toc.js"></script>
	
	<title>Support different CotEditor versions in AppleScript</title>
</head>

<body>

<h1>Support different CotEditor versions in AppleScript</h1>

<p>This page lists the previous specific changes on AppleScript support in CotEditor.</p>


<article>
<h2>Terminology change on CotEditor 6.0.0</h2>

<section>
	<h3>Deprecate <code>change kana</code></h3>
	<p>The <code>change kana</code> command was deprecated on CotEditor 6.0.0.</p>
	<p>Note that <strong>there is no backward compatibility</strong> with this change.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 5.1.0</h2>

<section>
	<h3>Control the editability of documents</h3>
	<p>A new property <code>editable</code> was added to the ‘document’ object.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 5.0.7</h2>

<section>
	<h3>Improve <code>write to console</code> command</h3>
	<p>Add <code>title</code> and <code>timestamp</code> options to the <code>write to console</code> command, so that the script name and timestamp can be omitted when writing to the console programmatically.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 5.0.0</h2>

<section>
	<h3>Change character range unit to grapheme cluster based</h3>
	<p>Change the character unit, used in <code>selection</code> or <code>jump</code> for example, from UTF-16 based to the Unicode grapheme cluster-based. This is to follow the specification change in <a href="https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_classes.html#//apple_ref/doc/uid/TP40000983-CH1g-BBCIAHJF" ref="external">AppleScript 2.0</a> introduced in Mac OS X 10.5.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 4.4.0</h2>

<section>
	<h3>Deprecate <code>length</code></h3>
	<p>The <code>length</code> property for the ‘document’ object was deprecated.</p>
	<p>For backward compatibility, CotEditor 4.4.0 still accepts using this property; however, it can be removed someday in the future without announcement.</p>
</section>
<section>
	<h3>Delete backward compatibility of <code>path</code></h3>
	<p>The <code>path</code> property, which was deprecated in CotEditor 2.0.0 but stealthily kept for backward compatibility, is completely deleted in this version.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 4.1.0</h2>

<section>
	<h3>Jump</h3>
	<p>A new command <code>jump</code> was added to the ‘document’ object.</p>
</section>
<section>
	<h3>Support encodings with BOM</h3>
	<p>A new property <code>has BOM</code> was added to the ‘document’ object.</p>
	<p>A new option <code>BOM</code> was added to the <code>convert</code> command.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 4.0.7</h2>

<section>
	<h3>Encoding <code>convert</code> / <code>reinterpret</code></h3>
	<p>Now <code>convert</code> and <code>reinterpret</code> commands accept the encoding also in the IANA charset name.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 3.9.7</h2>

<section>
	<h3>Smart quotes</h3>
	<p>The following new commands were added to the ‘selection’ object.</p>
	<ul class="nostyle">
		<li><p><code>smarten quotes</code></p></li>
		<li><p><code>straighten quotes</code></p></li>
		<li><p><code>smarten dashes</code></p></li>
	</ul>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 3.5.0</h2>

<section>
	<h3>Editor’s opacity</h3>
	<p><code>view opacity</code> property was deprecated on CotEditor 3.5.0.</p>
	<p>Note that <strong>there is no backward compatibility</strong> with this change.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 3.1.2</h2>

<section>
	<h3>Auto tab expansion</h3>
	<p>A new property <code>expands tab</code> was added to the ‘document’ object.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 2.6.0</h2>

<section>
	<h3>Line spacing property</h3>
	<p><code>line spacing</code> property was deprecated on CotEditor 2.6.0.</p>
	<p>Note that <strong>there is no backward compatibility</strong> with this change.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 2.5.3</h2>

<section>
	<h3>Unicode normalization</h3>
	<p>A new value <code>Modified NFC</code> was added to the <code>normalize unicode</code> command.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 2.3.0</h2>

<section>
	<h3>Selected line editing</h3>
	<p>The following new commands were added to the ‘selection’ object.</p>
	<ul class="nostyle">
		<li><p><code>move line up</code></p></li>
		<li><p><code>move line down</code></p></li>
		<li><p><code>sort lines</code></p></li>
		<li><p><code>reverse lines</code></p></li>
		<li><p><code>delete duplicate line</code></p></li>
	</ul>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 2.2.2</h2>

<section>
	<h3>Unicode normalization</h3>
	<p>A new value <code>Modified NFD</code> was added to the <code>normalize unicode</code> command.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 2.2.0</h2>

<section>
	<h3>Unicode normalization</h3>
	<p>A new value <code>NFCK Casefold</code> was added to the <code>normalize unicode</code> command.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 2.1.0</h2>

<section>
	<h3>Tab width</h3>
	<p>A new property <code>tab width</code> was added to the ‘document’ object.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 2.0.1</h2>

<section>
	<h3>Comment handling</h3>
	<p>New commands <code>comment out</code> and <code>uncomment</code> were added to the ‘selection’ object.</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 2.0.0</h2>

<section>
	<h3>Unicode normalization</h3>
	<p>The command <code>unicode normalization</code> on CotEditor 1.x was renamed on 2.0 to <code>normalize unicode</code>. The function and parameters are the same as before.</p>
	<p>Note that <strong>there is no backward compatibility</strong> with this change.</p>
</section>

<section>
	<h3>Discontinuation of <code>path</code> property</h3>
	<p>The <code>path</code> property of ‘document’ object is discontinued on the modern AppleScript’s Standard Suite for a long time. Since CotEditor adopted it on version 2.0, this property is also deprecated on CotEditor. Use new <code>file</code> property instead. Whereas <code>path</code> property returns a text object, <code>file</code> property returns a file object.</p>
	<p>For backward compatibility, CotEditor 2.0 added a hidden <code>path</code> property to ‘document’ object uniquely; however, don’t use it if you create new scripts and we also recommend migrating your previous scripts to use <code>file</code> property. Because this `path` property can be removed someday in the future without announcement.</p>
</section>

<section>
	<h3>Update of internal code for <code>range</code> property</h3>
	<p>The internal code for <code>range</code> property of the text selection object to identify itself has been changed on CotEditor 2.0. The key for the range property is still <code>range</code>, so you don’t need to care about this if you write a new script. However, <strong>compiled</strong> AppleScripts (.scpt) which were written previously might need some updates for this change.</p>

	<h4>How to fix:</h4>
	<p>Open your .scpt files on AppleScript Editor (or Script Editor), the words that were <code>range</code> previously might be changed to <code>«class prng»</code> or something like that. Overwrite them with <code>range</code> again. And save them. This issue doesn’t occur with plain text AppleScript (.applescript).</p>
</section>
</article>


<article>
<h2>Terminology change on CotEditor 1.5.0</h2>

<section>
	<h3>Window transparency</h3>
	<p>According to the changing of the mechanism to make the window transparent on CotEditor 1.5, the terms about window opacity for AppleScript were also changed. The <b>document</b>’s properties till on version 1.4:</p>

	<ul class="nostyle">
		<li><p><code>transparency</code>: The transparency of Window or TextView. (real, from ‘0.2’ to ‘1.0’)</p></li>
		<li><p><code>alpha only textView</code>: Whether the transparency setting affects only the TextView or not. (boolean)</p></li>
	</ul>
	
	<p>were deprecated, and the new <b>window</b>’s property:</p>
	
	<ul class="nostyle">
		<li><p><code>view opacity</code>: The opacity of the view. (real, from ‘0.2’ to ‘1.0’)</p></li>
	</ul>
	
	<p>was added instead.</p>
	
	<p>Because the previous term “transparency” was incorrectly used until version 1.4, the property name was renamed from “transparency” to “opacity” but the value to set is not changed. Namely, 1.0 means fully opaque on both properties.</p>
	<p>Note that <strong>there is no backward compatibility</strong> with this change.</p>
</section>

<section>
	<h3>Selection object directly under the application</h3>
	<p>In version 0.6, the initial release of CotEditor, if you didn’t specify the ‘selection’ object, the frontmost window’s content is selected. But it actually didn’t work correctly and therefore deprecated. This method was kept valid however to maintain backward compatibility.</p>
	<p>On CotEditor 1.5, it is formally removed. Specify the target like below, when you get the ‘selection’ object.</p>
	
<figure>
<figcaption>example 1.</figcaption>
<pre class="source"><code class="AppleScript">tell application "CotEditor"
	contents of selection <b>of front document</b>
end tell
</code></pre>
</figure>

<figure>
<figcaption>example 2.</figcaption>
<pre class="source"><code class="AppleScript">tell application "CotEditor"
	<b>tell document 1</b>
		contents of selection
	<b>end tell</b>
end tell
</code></pre>
</figure>
</section>
</article>


<section id="cf">
<h2>See also</h2>
<ul>
	<li><a href="script_osascript.html">Automate tasks using AppleScript in CotEditor on Mac</a></li>
</ul>
</section>
</body>
</html>
